<template>
  <el-dialog
    :title="title"
    :visible="visible"
    width="400px"
    :close-on-click-modal="false"
    @close="visible=false"
  >
    <el-form
      ref="form"
      :model="entityData"
      :rules="rules"
      label-width="80px"
      label-position="right"
      style="width:90%;margin:0px auto;"
    >
      <!--表单区域 -->
      <el-form-item label="名称" prop="name">
        <el-input v-model="entityData.name" :readonly="readonly" />
      </el-form-item>
      <el-form-item label="编码" prop="code">
        <el-input v-model="entityData.code" :readonly="readonly" />
      </el-form-item>
      <el-form-item label="处理器" prop="handler">
        <el-input v-model="entityData.handler" :readonly="readonly" />
      </el-form-item>
      <el-form-item label="分类" prop="category">
        <dictionary-select
          v-model="entityData.category"
          :code="$constant.API_SERVICE_CATEGORY"
          :readonly="readonly"
        />
      </el-form-item>

      <el-form-item label="状态" prop="status">
        <dictionary-radio-group
          v-model="entityData.status"
          :code="constant.DICTIONARY_TYPE_CODES.STATUS"
          :readonly="readonly"
        />
      </el-form-item>
      <el-form-item label="备注" prop="remark">
        <el-input v-model="entityData.remark" :readonly="readonly" />
      </el-form-item>
      <el-form-item label="排序号" prop="orderNo">
        <el-input v-model="entityData.orderNo" :readonly="readonly" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button v-show="saveButtonVisible" type="primary" @click="save">保存</el-button>
      <el-button @click="close">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { detailMixin } from '@/mixin/detailMixin'
const MODULE_CODE = 'cip'
const ENTITY_TYPE = 'apiService'
export default {
  name: ENTITY_TYPE + '-detail',
  mixins: [detailMixin],
  data() {
    return {
      entityType: ENTITY_TYPE,
      moduleCode: MODULE_CODE,
      // eslint-disable-next-line no-eval
      api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE),
      pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':',
      entityData: {

      },
      rules: {
        // 前端验证规则
        name: [
          { required: true, message: '请输入名称', trigger: 'blur' }
        ],
        code: [
          { required: true, message: '请输入编码', trigger: 'blur' }
        ],
        handler: [
          { required: true, message: '请输入处理器', trigger: 'blur' }
        ],
        category: [
          { required: true, message: '请选择分类', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {

  }

}
</script>

<style lang="scss">
</style>
